from django.views.generic import list_detail
from blog.models import *


def category_detail(request, slug, **kwargs):
  category = Category.objects.get(slug=slug)
  queryset = category.post_set.all()
  return list_detail.object_list(
    request,
    queryset = queryset,
    paginate_by = 20,
    extra_context = { 'category':category, },
    template_name = 'blog/category_detail.html',
    **kwargs
  )